# Tanım: Python'da yazılmış, Git ve Bazaar'a benzer,dağıtılmış bir kaynak denetim yönetimi aracıdır.
# URL: http://mercurial.selenic.com
# Paketçi: milisarge
# Gerekler: python tk
# Grup: geliştirme

isim=mercurial
surum=4.3.1
devir=1
kaynak=(https://www.mercurial-scm.org/release/mercurial-$surum.tar.gz
		mercurial.profile)
 
derle() {
	cd $isim-$surum	
	sed -i -e 's#env python#env python2#' mercurial/lsprof.py
	cd contrib/chg
	make
	cd $SRC/${isim}-${surum}
	python2 setup.py install --root="${PKG}/" --optimize=1

	install -d ${PKG}/usr/share/man/{man1,man5}
	install -m644 doc/hg.1 "${PKG}/usr/share/man/man1"
	install -m644 doc/{hgrc.5,hgignore.5} "${PKG}/usr/share/man/man5"
	install -m755 contrib/hgk "${PKG}/usr/bin"
	install -m644 -D contrib/zsh_completion "${PKG}/usr/share/zsh/site-functions/_hg"
	install -m644 -D contrib/bash_completion "${PKG}/usr/share/bash-completion/completions/hg"
	install -d "${PKG}/usr/share/emacs/site-lisp"
	install -m644 contrib/{mq.el,mercurial.el} "${PKG}/usr/share/emacs/site-lisp"

	vimpath="${PKG}/usr/share/vim/vimfiles"
	install -Dm644 contrib/vim/HGAnnotate.vim "${vimpath}/syntax/HGAnnotate.vim"

	# set some variables
	install -m755 -d ${PKG}/etc/profile.d
	install -m755 ${SRC}/mercurial.profile "${PKG}/etc/profile.d/mercurial.sh"

	# install configuration file
	install -m755 -d ${PKG}/etc/mercurial
	# install -m644 contrib/sample.hgrc "${PKG}/etc/mercurial/hgrc"

	# FS#38825 - Add certs config to package
	echo -e "\n[web]\ncacerts = /etc/ssl/certs/ca-certificates.crt\n" >> "${PKG}/etc/mercurial/hgrc"

	cd contrib/chg
	make DESTDIR="${PKG}" PREFIX=/usr install
}
